from random import randint
target = randint(1,100)
answer =""
index = randint(1,4)
right=["你的运气不错","呵呵猜对了","你是不是提前看答案了","真聪明能干"]
big=["好像大了","高了一些","应当再小一些","大于答案"]
small=["太小了","可以再大一些","小于正确答案","，还可以向上一些"]
guess = int(input("请猜测一下生成的数字"))

if guess == target:
      answer=right[index]
elif guess>target:
      answer=big[index]
else:
      answer=small[index]
print(answer)

from random import randint
import turtle1 as tt

tt.setup(width=800,height=450,startx=None,starty=None)
tt.hideturtle()
tt.color("blue")
tt.penup()
tt.setpos(-300,0)
myfont=("黑体",16,"normal")

target = randint(1,100)
answer =""
guess=0
cnt=0
right=["你的运气不错","呵呵猜对了","你是不是提前看答案了","真聪明能干"]
big=["好像大了","高了一些","应当再小一些","大于答案"]
small=["太小了","可以再大一些","小于正确答案","还可以向上一些"]
while guess!=answer:
      guess = tt.simpledialog.askinteger("猜测游戏","请猜测一下生成的数字")
      cnt=cnt+1
      index = randint(1,4)
      if guess == target:
            answer=f"{right[index]},这个数是{target},你猜测了{cnt}次"
      elif not guess:
            tt.write("你放弃猜测了，游戏结束",font=myfont)
            break
      elif guess>target:
            answer=f"{big[index]},再猜测一次"
      else:
            answer=f"{small[index]},再猜测一次"
      tt.clear()
      tt.write(answer,font=myfont)
tt.done()
#      print(answer)

